<style>
blockquote,
body,
button,
code,
dd,
div,
dl,
dt,
fieldset,
figure,
form,
h1,
h2,
h3,
h4,
h5,
h6,
input,
legend,
li,
ol,
p,
pre,
td,
textarea,
th,
ul {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

a {
    text-decoration: none;
}

.loginHtml {
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: #fff;
}

.title {
    width: 1600px;
    display: flex;
    justify-content: space-between;
    margin-right: auto;
    margin-left: auto;
}

.title .title-1 {
    background-image: url(//member-ssl.vipstatic.com/img/passport/sprites-hash-c9975078.png?1d3187cc);
    background-position: -308px -57px;
    width: 125px;
    height: 100px;
    display: inline-block;
    vertical-align: top;
    line-height: 500px;
    overflow: hidden;
}

.title .pecu {
    background-image: url(//member-ssl.vipstatic.com/img/passport/sprites-hash-c9975078.png?1d3187cc);
    background-position: 0 0;
    width: 304px;
    height: 100px;
    position: absolute;
    margin-right: 200px;
    top: 0;
    right: 0;
    z-index: 1;
}

.body {
    height: 650px;
    background-position: top center;
    background-repeat: no-repeat
}

.body-content {
    margin-right: auto;
    margin-left: auto;
    padding: 50px 20px;
    min-height: 550px;
    width: 1000px;
}

.loginBox {
    width: 380px;
    border-bottom: 1px solid #e0e0e0;
}

.loginHtml {
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: #fff;
}

.title {
    width: 1600px;
    display: flex;
    justify-content: space-between;
    margin-right: auto;
    margin-left: auto;
}

.title .title-1 {
    background-image: url(//member-ssl.vipstatic.com/img/passport/sprites-hash-c9975078.png?1d3187cc);
    background-position: -308px -57px;
    width: 125px;
    height: 100px;
    display: inline-block;
    vertical-align: top;
    line-height: 500px;
    overflow: hidden;
}

.title .pecu {
    background-image: url(//member-ssl.vipstatic.com/img/passport/sprites-hash-c9975078.png?1d3187cc);
    background-position: 0 0;
    width: 304px;
    height: 100px;
    position: absolute;
    margin-right: 200px;
    top: 0;
    right: 0;
    z-index: 1;
}

.body {
    height: 650px;
    background-position: top center;
    background-repeat: no-repeat
}

.body-content {
    margin-right: auto;
    margin-left: auto;
    padding: 50px 20px;
    min-height: 550px;
    width: 1000px;
}

.loginBox {
    width: 380px;
    border-bottom: 1px solid #e0e0e0;

    background-color: #fff;
    float: right;
}

.login-nav .nav-item {
    display: inline-block;
    width: 180px;
    vertical-align: top;
    text-align: center;
    color: #666;
    font-size: 18px;
    font-weight: 700;
    line-height: 50px;
    cursor: pointer;
    overflow: hidden;
}

.login-nav::after {}

.nav-item-qr {
    position: relative;
}

.nav-item-qr:after {
    position: absolute;
    top: 15px;
    right: 0;
    z-index: 1;
    width: 1px;
    height: 20px;
    background-color: #ccc;
    content: '';
    font-size: 0;
    line-height: 0;
}

.content-item .qr-code {
    padding-top: 36px;
    text-align: center;
    min-height: 192px;
}

.content-item .qr-code .qr-code-img {
    background-color: #fff;
}

.qr-code-img img {
    width: 150px;
    height: 150px;
    padding: 10px;
    border: 1px solid #f0f0f0;
}

.qr-code .qr-code-text {
    margin-top: 20px;
    color: #333;
    line-height: 16px;
}

.qr-icon {
    display: inline-block;
    vertical-align: top;
    background-image: url(//member-ssl.vipstatic.com/img/passport/sprites-hash-c9975078.png?1d3187cc);
    background-position: -605px -121px;
    width: 16px;
    height: 16px;
}

.qr-text-highlight {
    color: #f10180;
}

.qr-from {
    margin-left: 30px;
    margin-top: 15px;
}

.qr-input {
    vertical-align: top;
    margin-top: 2px;
}

.qr-input input {
    vertical-align: text-top;
    /* display: none; */
}

.qr-link {
    color: #1d94d1;
    display: inline-block;
    vertical-align: middle;
    font-size: 12px;
    line-height: 1.5;
}

.qr-tip {
    font-size: 12px;
    color: #ec5042;
    position: relative;
    min-height: 19px;
    max-height: 36px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-top: 2px;
    margin-bottom: 5px;
    line-height: 1.5;
    display: block;
}

.login-footer {
    padding-right: 30px;
    padding-left: 30px;
}

.footer {
    width: 300px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    padding-top: 30px;
    padding-bottom: 15px;
}

.footer::before {
    display: table;
    content: ' ';
}

.c-login-third-wechat-icon {
    background-image: url(//member-ssl.vipstatic.com/img/passport/sprites-hash-c9975078.png?1d3187cc);
    background-position: -580px -161px;
    width: 40px;
    height: 40px;
    display: inline-block;
    position: relative;
    z-index: 3;
}

.c-login-third-special {
    position: relative;
    z-index: 1;
    margin-bottom: 10px;
    height: 40px;
}

.c-login-third-special::after {
    position: absolute;
    z-index: 1;
    content: '';
    top: 20px;
    left: 0;
    width: 100%;
    border-top: 1px solid #e0e0e0;
}

.main {
    /* display: flex; */
}

.mainList {
    list-style: none;
    display: inline-block;
    vertical-align: middle;
    display: flex;
    width: 500px;
    padding: 0;
}

.mainList::after {
    clear: both;
}

.main-item {
    float: left;
    position: relative;
    padding-right: 11px;
    padding-left: 10px;
    line-height: 24px;
}

.main-bor::after {
    position: absolute;
    top: 50%;
    right: 0;
    z-index: 1;
    margin-top: -5px;
    height: 10px;
    content: '';
    border-left: 1px solid #e0e0e0;
}

.main-item a {
    color: #333;
}

.main-item.main-wb a {
    cursor: default;
    color: #999;
}

.main-more {
    display: inline-block;
    margin-left: 20px;
    vertical-align: top;
    line-height: 24px;
    color: #999;
}

.main-text {}

.main-icon {
    font-family: vipFont;
    speak: none;
    font-style: normal;
    font-weight: 400;
    font-variant: normal;
    text-transform: none;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    margin-left: 5px;
    vertical-align: top;
    line-height: 24px;
}

.goRegist {
    float: right;
}

.goRegist span {
    color: #333;
}

/* .login{
        width: 100%;
        height: 460px;
        margin-top:230px ;
        background-color: #409efe;
        display: flex;
        justify-content: center;
       
    } */

.box {
    width: 380px;
    height: 330px;
    background-color: #fff;
    box-sizing: border-box;
}

img {
    width: 90px;
    height: 90px;
    margin-bottom: 30px;
    margin-top: 30px;
}

h1 {
    font-weight: 700;
    color: #409efe;
}

.form {
    width: 100%;
    height: 100%;
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.el-form {
    width: 100%;
}

.el-form-item {
    margin-top: 10px;
}

.el-input {
    width: 90%;
    height: 65px;
    line-height: 65px;
}

.el-button {
    width: 300px;
    padding: 10px;
    height: 50px;
    background-color: #f10180;
    font-size: 20px;
    color: #fff;
}

.el-button:hover {
    background-color: #f10180;
    color: #fff;
}

.nav-item:hover {
    color: #f10180;
}

.active {
    color: red;
    /* 激活状态的样式 */
}

.box {
    width: 380px;
    height: 330px;
    background-color: #fff;
    box-sizing: border-box;
}

/* img {
    width: 90px;
    height: 90px;
    margin-bottom: 30px;
    margin-top: 30px;
} */

h1 {
    font-weight: 700;
    color: #409efe;
}

.form {
    width: 100%;
    height: 100%;
    margin-top: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.el-form {
    width: 100%;
}

.el-form-item {
    margin-top: 10px;
}

.el-input {
    width: 90%;
    height: 65px;
    line-height: 65px;
}

.el-form-item .el-button {
    width: 300px;
    padding: 10px;
    height: 50px;
    background-color: #f10180;
    font-size: 20px;
    color: #fff;
}

.nav-item:hover {
    color: #f10180;
}

.active {
    color: red;
    /* 激活状态的样式 */
}
</style>
<template>
    <div>
        <div class="loginHtml">
            <!-- h头部 -->
            <div class="title">
                <div class="logo">
                    <div class="title-1">唯品会</div>
                </div>
                <!-- 三大特点 -->
                <div class="pecu">

                </div>
            </div>
            <!-- 登录 -->
            <div class="body"
                style="background-image: url(&quot;//b.appsimg.com/upload/momin/2020/12/14/15/1607915393371.jpg&quot;);">
                <div class="body-content">
                    <div class="loginBox">
                        <div class="login-header">
                            <div class="login-nav">
                                <div class="nav-item nav-item-qr" @click="currentTab = 'qr'"
                                    :class="{ active: currentTab === 'qr' }">
                                    扫码登录
                                </div>
                                <div class="nav-item" @click="currentTab = 'account'"
                                    :class="{ active: currentTab === 'account' }">
                                    账号登录
                                </div>
                            </div>
                        </div>
                        <div class="login-content">
                            <!-- 二维码登录 -->
                            <div class="content-item" v-if="currentTab === 'qr'">
                                <div class="qr-code">
                                    <div class="qr-code-img">
                                        <img src="https://passport.vip.com/qrLogin/getQrImage?qrToken=10000-50e907215cc74b6596080243eca3d054"
                                            alt="">
                                    </div>
                                    <div class="qr-code-text">
                                        <span class="qr-icon"></span>打开
                                        <span class="qr-text-highlight">唯品会APP-个人中心</span>，扫一扫登录
                                    </div>
                                    <div class="qr-from">
                                        <div class="qr-input">
                                            <input type="checkbox" id="qr-input">
                                            <label for="qr-input">
                                                我已阅读并接受以下条款：
                                                <a href="https://h5rsc.vip.com/h5rscSupportClause/h5rscSupportClause/index.html"
                                                    class="qr-link">《唯品会服务条款》</a>
                                                <a href="https://h5rsc.vip.com/h5rscSupportClause/h5rscSupportClause/index.html"
                                                    class="qr-link">《唯品会基本功能隐私政策》</a>

                                            </label>
                                        </div>
                                    </div>
                                    <div class="qr-tip">

                                    </div>
                                </div>
                            </div>
                            <!-- 账号登录 -->
                            <div class="content-item" v-if="currentTab === 'account'">
                                <div class="login">
                                    <div class="box">
                                        <div class="">
                                            <div class="form">
                                                <el-form :model="form" :rules="rules" ref="form" label-width="0px">
                                                    <el-form-item prop="name" style="margin-bottom: 20px;">
                                                        <el-input v-model="form.name" prefix-icon="el-icon-user-solid"
                                                            placeholder="请输入用户名"></el-input>
                                                    </el-form-item>
                                                    <el-form-item prop="password">
                                                        <el-input v-model="form.password" prefix-icon="el-icon-lock"
                                                            type="password" placeholder="请输入密码"
                                                            show-password></el-input>
                                                    </el-form-item>
                                                    <div class="qr-from">
                                                        <div class="qr-input">
                                                            <input type="checkbox" id="qr-input">
                                                            <label for="qr-input">
                                                                我已阅读并接受以下条款：
                                                                <a href="https://h5rsc.vip.com/h5rscSupportClause/h5rscSupportClause/index.html"
                                                                    class="qr-link">《唯品会服务条款》</a>
                                                                <a href="https://h5rsc.vip.com/h5rscSupportClause/h5rscSupportClause/index.html"
                                                                    class="qr-link">《唯品会基本功能隐私政策》</a>

                                                            </label>
                                                        </div>
                                                        <el-form :model="form" :rules="rules" ref="form"
                                                            label-width="0px">

                                                            <el-form :model="form" :rules="rules" ref="form"
                                                                label-width="0px">

                                                                <div class="qr-tip">

                                                                    <div class="qr-tip">

                                                                    </div>
                                                                    <el-form-item>
                                                                        <button type="button" class="el-button el-button--primary"  @click="logins" margin><span>登录</span>
                                                                        </button>
                                                                       

                                                                    </el-form-item>
                                                                </div>
                                                            </el-form>
                                                        </el-form>
                                                    </div>
                                                </el-form>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="login-footer">
                                <div class="footer">
                                    <div class="c-login-third-special">
                                        <div class="c-login-third-wechat-wrapper  ">
                                            <a class="c-login-third-wechat  " href="//passport.vip.com/login/weixin"
                                                target="_blank" rel="noopener"
                                                mars_sead="passport_bottom_weixin_button">
                                                <span class="c-login-third-wechat-icon"></span>
                                            </a>
                                        </div>
                                    </div>
                                    <div class="main">
                                        <ul class="mainList">
                                            <li class="main-item main-wb main-bor">
                                                <a href="javascript:;" title="新浪微博登录方式正在升级，暂不可用，请选择其他方式登录">新浪微博</a>
                                            </li>
                                            <li class="main-item main-bor">
                                                <a href="//passport.vip.com/login/qq">QQ</a>
                                            </li>
                                            <li class="main-item">
                                                <a href="//passport.vip.com/login/alipay">支付宝</a>
                                            </li>
                                            <a href="###" class="main-more">
                                                <span class="more-text">更多<span class="main-icon"></span>></span>
                                            </a>
                                            <div class="goRegist">
                                                <router-link to="/regist">免费注册</router-link>
                                            </div>
                                        </ul>
                                        <div class="footer-text"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="login-footer">
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <footers></footers>
    </div>
</template>
<script>
import { login } from "@/request/api/all"
import footers from "@/components/footer.vue"
export default {
    components: {
        footers
    },
    data() {
        return {
            currentTab: 'qr', // 默认显示二维码登录
            form: {
                name: "",
                password: ""
            },
            rules: {
                name: [
                    { required: true, message: '请输入用户名', trigger: 'blur' },
                    { min: 2, max: 8, message: '长度在 2 到 8 个字符', trigger: 'blur' }
                ],
                password: [
                    { required: true, message: '请输入密码', trigger: 'blur' },
                    { min: 5, max: 11, message: '长度在 5 到 11 个字符', trigger: 'blur' }
                ],
            }
        }
    },
    methods: {
        logins() {
            this.$refs.form.validate(async (valid) => {
                if (valid) {
                    console.log('登录!');
                    let res = await login('/login', {
                        username: this.form.name,
                        password: this.form.password
                    })
                    console.log("res",res)
                    localStorage.setItem('username',this.form.name)
                    
                    // 页面跳转
                    this.$router.push({
                        path: '/index'
                    })
                } else {
                    console.log('登录失败!!');
                }
            })
        }
    }
}


</script>
